package com.jzo2o.customer.controller.worker;

import com.jzo2o.common.utils.UserContext;
import com.jzo2o.customer.model.dto.request.WorkerCertificationAuditAddReqDTO;
import com.jzo2o.customer.model.dto.response.RejectReasonResDTO;
import com.jzo2o.customer.service.IServiceCertificationService;
import com.jzo2o.customer.service.WorkerCertificationAuditService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController("workerServiceCertificationController")
@RequestMapping("/worker/worker-certification-audit")
@Api(tags = "服务端 - 服务人员认证相关接口")
public class ServiceCertificationController {
    @Resource
    private IServiceCertificationService serviceCertificationService;
    @Resource
    private WorkerCertificationAuditService workerCertificationAuditService;


    @PostMapping
    @ApiOperation("服务人员认证申请审核")
    public void audit( @RequestBody WorkerCertificationAuditAddReqDTO workerCertificationAuditAddReqDTO) {
        workerCertificationAuditAddReqDTO.setServeProviderId(UserContext.currentUserId());
        serviceCertificationService.audit(workerCertificationAuditAddReqDTO);
    }


    @GetMapping("/rejectReason")
    @ApiOperation("获取认证拒绝原因")
    public RejectReasonResDTO getRejectReason() {
        return serviceCertificationService.queryCurrentUserLastRejectReason();
    }
}
